<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>开始安装 - 环境检测</title>
    <link href="./css/material-dashboard.min.css?v=2.1.1" rel="stylesheet">
    <meta data-n-head="1" data-hid="viewport" name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

<div class="progress">
  <div class="progress-bar progress-bar-striped" role="progressbar" style="width: 25%;background-color: #9c27b0" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
  <div class="progress-bar progress-bar-striped" role="progressbar" style="width: 25%;background-color: #ff9800" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>


<div class="card card-nav-tabs text-center" style="width: 50%;/* margin-top: 30%; */margin: 10% auto;">
    <div class="card-header card-header-primary" style="padding-top: 4px;padding-bottom: 10px;">
        <a href="#" class="badge badge-success"><?php echo $config['version']?></a>
        <br>环境检测
    </div>
    <div class="card-body">
    <table class="table">
        <thead>
            <tr>
                <th class="text-center">环境</th>
                <th>最低配置</th>
                <th>当前配置</th>
                <th>是否符合</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="text-center">操作系统</td>
                <td>不限</td>
                <td><?php echo php_uname('s'); ?></td>
                <td><span class="badge badge-success">符合</span></td>
            </tr>
            <tr>
                <td class="text-center">PHP版本</td>
                <td>7.0</td>
                <td><?php echo PHP_VERSION ?></td>
                <?php $php_version=explode('.', PHP_VERSION); ?>
                <td>
                    <?php if (($php_version['0']>=7 && $php_version['0']>=1)): ?>
                    <span class="badge badge-success yes">符合</span>
                    <?php else: ?>
                    <span class="badge badge-danger">不符</span>
                    <?php endif ?>
                </td>
            </tr>
        </tbody>
    </table>
    <table class="table">
        <thead>
            <tr>
                <th class="text-center">目录</th>
                <th>最低权限</th>
                <th>当前权限</th>
                <th>是否符合</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="text-center">../</td>
                <td>可写</td>
                <td>
                    <?php if (is_writable('../')): ?>
                        可写
                    <?php else: ?>
                        不可写
                    <?php endif ?>
                </td>
                <td>
                    <?php if (is_writable('../')): ?>
                        <span class="badge badge-success yes">符合</span>
                    <?php else: ?>
                        <span class="badge badge-danger">不符</span>
                    <?php endif ?>
                </td>
            </tr>
            <tr>
                <td class="text-center">../install</td>
                <td>可写</td>
                <td>
                    <?php if (is_writable('../install')): ?>
                        可写
                    <?php else: ?>
                        不可写
                    <?php endif ?>
                </td>
                <td>
                    <?php if (is_writable('../install')): ?>
                        <span class="badge badge-success yes">符合</span>
                    <?php else: ?>
                        <span class="badge badge-danger">不符</span>
                    <?php endif ?>
                </td>
            </tr>
        </tbody>
    </table>
    <a href="./index.php?type=<?php echo $config['indexPage']; ?>" class="btn btn-primary btn-pro-component">上一步<div class="ripple-container"></div></a>
    <a href="javascript:;" url-href="./index.php?type=<?php echo $config['createPage']; ?>" class="btn btn-primary btn-pro-component next">下一步<div class="ripple-container"></div></a>
</div>
</div>

<script type="text/javascript" src="frame/layui/layui.js"></script>
<script>
    layui.use('layer', function(){
        var $ = layui.jquery,layer = layui.layer;

        // 判断是否通过
        $('.next').on('click',function(){
            // 判断检测是否达标
            if($('.yes').length != 3){
                layer.msg('您的配置或权限未满足要求');
            }else{
                location.href = $(this).attr('url-href');
            }
        });
    });
</script>
</body>
</html>